package cn.wolfcode.trip.base.mapper;

import cn.wolfcode.trip.base.domain.User;
import cn.wolfcode.trip.base.query.QueryObject;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface UserMapper {

    int insert(User record);

    User selectByPrimaryKey(Long id);

    List<User> selectAll(QueryObject qo);

    int updateByPrimaryKey(User record);

    String selectByEmail(String email);

    User  selectByEmailAndPassword(@Param("email") String email, @Param("password") String password);

    /**
     * 查询用户积分
     * @param id
     * @return
     */
    int selectUserPointsById(Long id);

    /**
     *
     * @param userId 用户ID
     * @param point 新增积分数
     */
    void addPoint(@Param("userId") Long userId, @Param("point") int point);

    void updatePoint(@Param("id") Long id, @Param("consume") Integer consume);
}